layui.use('table', function() {
	var table = layui.table,layer=layui.layer;
	
	
	var $ = layui.$, active = {
		reload: function() {
			var csLoding=layer.msg('数据加载中...', {
				icon: 16,
				shade: 0.3,
				success: function() {
					var mid = $('#mid').val();
					var operate = $("#operate option:selected").val();
					var flag = $("#flag option:selected").val();
					var coin_id = $("#coin_id option:selected").val();
					var start = $('#start').val();
					var end = $('#end').val();
		
					//执行重载
					table.reload('idTest', {
						page: {
							curr: 1 //重新从第 1 页开始
						},
						where: {
							key: {
								
								mid:mid,
								operate:operate,
								flag:flag,
								coin_id:coin_id,
								start: start,
								end: end
							}
						},
						done: function(){
						     layer.close(csLoding)
						}
					});
				}
			})
			
		}
	 }
	$('.right-center #ScreenBnt').on('click', function() {
		var type = $(this).data('type');
		active[type] ? active[type].call(this) : '';
	});
	
	
	var csLoding=layer.msg('数据加载中...', {
		icon: 16,
		shade: 0.3,
		success: function() {
			table.render({
				elem: '#centet-cen',
				url: listSrc,
				height: $(".center-tab").height(),
				id:'idTest',
				page:true,
				response: {
		  			statusCode: 1, //成功的状态码，默认：0
				},
				cols: [
					[ //标题栏
						{
							field: 'id',
							title: '交易编号'
						}, {
							field: 'mid',
							title: '会员编号'
						}, {
							field: 'operate_remark',
							title: '类型'
						}, {
							field: 'coin_name',
							title: '货币'
						}, {
							field: 'amount',
							title: '金额',
							templet: '#sexTpl'
						}, {
							field: 'remark',
							title: '说明',
							width: 450
						}, {
							field: 'before_amount',
							title: '交易前'
						}, {
							field: 'after_amount',
							title: '交易后'
						}, {
							field: 'create_date',
							title: '时间',
							width: 170
						}

					]
				],
				limit: 20,
				done:function(){
					layer.close(csLoding)
				}
			});
		}
	});
	
	
	
})

layui.use(['form', 'layedit', 'laydate'], function(){
	 var form = layui.form,layer = layui.layer,layedit = layui.layedit,laydate = layui.laydate;
	laydate.render({
		elem: '#start'
	});
	laydate.render({
		elem: '#end'
	});
})


$(function() {
	cionFun();
    flagFun();
    recordFun();
    cionFun();
    
	$("#Expbnt").click(function(){
		$("#screen-form").attr("action",ExpSrc);
	})
	
})